import scipy.special 


def gamma( z ):
    """ http://en.wikipedia.org/wiki/Gamma_function 
    In Mathematica = Gamma[z] """
    res = scipy.special.gamma(z)
    return res

def gamma_incomplete_lower( z, s ):
    """ http://en.wikipedia.org/wiki/Incomplete_gamma_function 
    In Mathematica = Gamma[z] - Gamma[z,s] """
    res = scipy.special.gammainc(z,s) * scipy.special.gamma(z)
    return res

def gamma_incomplete_upper( z, s ):
    """ http://en.wikipedia.org/wiki/Incomplete_gamma_function 
    In Mathematica = Gamma[z,s] """
    res = scipy.special.gammaincc(z,s) * scipy.special.gamma(z)
    return res

def exponential_integral( n, z ):
    """ E_n(x) from http://en.wikipedia.org/wiki/Exponential_integral 
    In Mathematica = ExpIntegralE[n,z] """
    res = z**(n-1) * gamma_incomplete_upper( 1-n, z )
    return res


if __name__ == '__main__':
    print 'main'
